<?php

namespace Frontend\Controllers;
class BaseController extends \Phalcon\Mvc\Controller
{
    public function beforeExecuteRoute($dispatcher)
    {

    }

    public function json()
    {
        $args = func_get_args();
        $result = array();
        $status = $args[0];
        $result['status'] = $status;
        if (count($args) > 1) {
            if ($status == 1) {
                $result['data'] = $args[1];
            } else {
                $result['error_msg'] = $args[1];
            }
        }
        if (count($args) > 2) {
            if ($status != 1) {
                $result['error_code'] = $args[2];
            }
        }
        return json_encode($result);
    }


}